In Vim, you can find and replace text using the :substitute ( :s ) command. To run commands in Vim, you must be in normal mode, the default mode when starting ... Basic Find and Replace · Case Sensitivity · Search Range
I can use :5,12s/foo/bar/g to search for foo and replace it by bar between lines 5 and 12. How can I do that only in line 5 and 12 (and not in the lines in ...
The following search command will make a range and search/replace within it. Specifically, it looks for 'first' in the text, then stops when it finds 'second' ...
One method is to use marks: Type ma in the first line, then type mb in the last line (to set marks a and b ). Then enter command :'a,'bs/old/new/g to substitute ... Examples · Default range · Selections · Deleting, copying and moving